const Router = require('koa-router')
const { orderDetail } = require('../json/orderDetail')

const router = new Router({
  prefix:'/sjj'
})

// 子订单数据
router.get('/orderData', async (ctx, next) => {

  ctx.body = {
    code: 200,
    message: "调用成功。",
    result: {
      dataList: [
        {
          id: 1,
          orderId: 3123123123,
          orderPic: 123,
          orderStatus: 1,
          orderName: '商品名称1',
          orderAddress: '甘肃省天水市',
          buyerName: '张三',
          storeName: '小小铺子',
          storeId: 1313213234,
          storeAddress: '广东省广州市',
          orderTime: '2019-10-20T09:15:44.000+0000'
        },
        {
          id: 2,
          orderId: 3213123123124,
          orderPic: 342,
          orderStatus: 2,
          orderName: '商品名称2',
          orderAddress: '上海市青浦区',
          buyerName: '李四',
          storeName: '淘宝店铺',
          storeId: 21323233443,
          storeAddress: '安徽省蚌埠市',
          orderTime: '2019-01-20T09:15:44.000+0000'
        },
        {
          id: 3,
          orderId: 78664324254,
          orderPic: 1232,
          orderStatus: 3,
          orderName: '火龙果',
          orderAddress: '安徽合肥',
          buyerName: '王五',
          storeName: '京东小铺',
          storeId: 3343243421,
          storeAddress: '江西省',
          orderTime: ''
        },
        {
          id: 4,
          orderId: 34645634,
          orderPic: 123,
          orderStatus: 1,
          orderName: '苹果',
          orderAddress: '河北省石家庄市',
          buyerName: '惹我',
          storeName: '发给大哥',
          storeId: 345342534535,
          storeAddress: '山东省济南市',
          orderTime: '2019-02-20T09:15:44.000+0000'
        },
        {
          id: 5,
          orderId: 14324242423432,
          orderPic: 123,
          orderStatus: 2,
          orderName: '范德萨',
          orderAddress: '河北省唐山市',
          buyerName: '大幅度',
          storeName: '方大哥',
          storeId: 5342534565,
          storeAddress: '山东省青岛市',
          orderTime: '2019-08-20T09:15:44.000+0000'
        },
        {
          id: 6,
          orderId: 654645646,
          orderPic: 123,
          orderStatus: 3,
          orderName: '范二萨',
          orderAddress: '河北省保定市',
          buyerName: '人人',
          storeName: '撒旦法',
          storeId: 32546566,
          storeAddress: '山东省枣庄市',
          orderTime: ''
        },
        {
          id: 7,
          orderId: 546546464656,
          orderPic: 123,
          orderStatus: 3,
          orderName: '而问题',
          orderAddress: '山西省太原市',
          buyerName: '鄂武商',
          storeName: '同一人',
          storeId: 53425432654,
          storeAddress: '山东省烟台市',
          orderTime: ''
        },
        {
          id: 8,
          orderId: 6546423423,
          orderPic: 123,
          orderStatus: 3,
          orderName: '而特',
          orderAddress: '山西省大同市',
          buyerName: '鄂武天天',
          storeName: '广东省非常',
          storeId: 342634636546,
          storeAddress: '山东省东营市',
          orderTime: ''
        },
        {
          id: 9,
          orderId: 6765765765,
          orderPic: 123,
          orderStatus: 2,
          orderName: '而特同仁堂人',
          orderAddress: '山西省阳泉市',
          buyerName: '撒旦法',
          storeName: '广东佛山峰',
          storeId: 532456645635,
          storeAddress: '河南省郑州市',
          orderTime: '2019-07-20T09:15:44.000+0000'
        },
        {
          id: 10,
          orderId: 3453453535,
          orderPic: 123,
          orderStatus: 2,
          orderName: '特务人',
          orderAddress: '辽宁省大连市',
          buyerName: '特意',
          storeName: '发的山峰',
          storeId: 457765765,
          storeAddress: '河南省开封市',
          orderTime: '2019-05-20T09:15:44.000+0000'
        },
        {
          id: 11,
          orderId: 43524324234,
          orderPic: 123,
          orderStatus: 1,
          orderName: '同人文人',
          orderAddress: '辽宁省沈阳市',
          buyerName: '萨达',
          storeName: '单方',
          storeId: 75675756,
          storeAddress: '河南省洛阳市',
          orderTime: '2018-05-20T09:15:44.000+0000'
        },
        {
          id: 12,
          orderId: 654646,
          orderPic: 123,
          orderStatus: 1,
          orderName: '同塔尔问题',
          orderAddress: '辽宁省本溪市',
          buyerName: '送达',
          storeName: '大范甘迪峰',
          storeId: 345645653657,
          storeAddress: '河南省平顶山市',
          orderTime: '2018-01-20T09:15:44.000+0000'
        },
        {
          id: 13,
          orderId: 2436135436,
          orderPic: 123,
          orderStatus: 2,
          orderName: 'terw问题',
          orderAddress: '吉林省长春市',
          buyerName: '热土',
          storeName: '大峰',
          storeId: 654657435664,
          storeAddress: '河南省安阳市',
          orderTime: '2018-11-20T09:15:44.000+0000'
        },
        {
          id: 14,
          orderId: 42342344,
          orderPic: 123,
          orderStatus: 2,
          orderName: 't同人文热',
          orderAddress: '吉林省四平市',
          buyerName: '天眼查',
          storeName: '单迪峰',
          storeId: 5343546456,
          storeAddress: '湖南省长沙市',
          orderTime: '2018-12-20T09:15:44.000+0000'
        },
        {
          id: 15,
          orderId: 43242424234,
          orderPic: 123,
          orderStatus: 1,
          orderName: 't同电饭锅热',
          orderAddress: '吉林省通化市',
          buyerName: '甘道夫',
          storeName: '单迪',
          storeId: 456367635435,
          storeAddress: '湖南省株洲市',
          orderTime: '2018-02-20T09:15:44.000+0000'
        },
        {
          id: 16,
          orderId: 43242342432,
          orderPic: 123,
          orderStatus: 1,
          orderName: 'web大概到',
          orderAddress: '黑龙江省哈尔滨市',
          buyerName: '塔尔',
          storeName: '甘迪峰',
          storeId: 43654563453,
          storeAddress: '湖南省湘潭市',
          orderTime: '2018-08-20T09:15:44.000+0000'
        },
        {
          id: 17,
          orderId: 65467678,
          orderPic: 123,
          orderStatus: 2,
          orderName: '儿童观大概到',
          orderAddress: '黑龙江省鸡西市',
          buyerName: '个地方官',
          storeName: '甘迪',
          storeId: 6456434546,
          storeAddress: '湖南省衡阳市',
          orderTime: '2018-07-20T09:15:44.000+0000'
        },
        {
          id: 18,
          orderId: 657834509,
          orderPic: 123,
          orderStatus: 2,
          orderName: '到结婚概到',
          orderAddress: '黑龙江省大庆市',
          buyerName: '东方双光鱼',
          storeName: '到底',
          storeId: 34534656776,
          storeAddress: '湖南省邵阳市',
          orderTime: '2017-07-20T09:15:44.000+0000'
        },
        {
          id: 19,
          orderId: 3453453234654,
          orderPic: 123,
          orderStatus: 3,
          orderName: '结婚概到',
          orderAddress: '浙江省杭州市',
          buyerName: 'DSS',
          storeName: '到底是告',
          storeId: 3456546,
          storeAddress: '湖南省岳阳市',
          orderTime: ''
        },
        {
          id: 20,
          orderId: 42342564,
          orderPic: 123,
          orderStatus: 3,
          orderName: '结到',
          orderAddress: '浙江省宁波市',
          buyerName: 'GSD',
          storeName: '的根深蒂固',
          storeId: 646456436,
          storeAddress: '湖南省岳阳市',
          orderTime: ''
        },
        {
          id: 21,
          orderId: 4234245553,
          orderPic: 123,
          orderStatus: 2,
          orderName: '结到覆盖的',
          orderAddress: '浙江省嘉兴市',
          buyerName: '鬼地方个',
          storeName: '的人',
          storeId: 3452352436456,
          storeAddress: '广东省广州市',
          orderTime: '2017-01-20T09:15:44.000+0000'
        },
        {
          id: 22,
          orderId: 23466576,
          orderPic: 123,
          orderStatus: 2,
          orderName: '结盖的',
          orderAddress: '浙江省绍兴市',
          buyerName: '阿凡达',
          storeName: '的人发的',
          storeId: 5346735467,
          storeAddress: '广东省韶关市',
          orderTime: '2017-07-20T09:15:44.000+0000'
        },
        {
          id: 23,
          orderId: 67868678,
          orderPic: 123,
          orderStatus: 1,
          orderName: '热淘宝',
          orderAddress: '浙江省温州市',
          buyerName: '大法师',
          storeName: '规广规的',
          storeId: 3455435,
          storeAddress: '广东省深圳市',
          orderTime: '2017-09-20T09:15:44.000+0000'
        },
        {
          id: 24,
          orderId: 67576575,
          orderPic: 123,
          orderStatus: 1,
          orderName: '热淘大法师',
          orderAddress: '福建省福州市',
          buyerName: '低首付',
          storeName: '法规及',
          storeId: 5346667867,
          storeAddress: '广东省珠海市',
          orderTime: '2017-06-20T09:15:44.000+0000'
        },
        {
          id: 25,
          orderId: 65757657,
          orderPic: 123,
          orderStatus: 1,
          orderName: '热淘但是法师',
          orderAddress: '福建省莆田市',
          buyerName: '当时发的',
          storeName: '法规发给',
          storeId: 5234676537,
          storeAddress: '广东省佛山市',
          orderTime: '2017-11-20T09:15:44.000+0000'
        },
        {
          id: 26,
          orderId: 7657535,
          orderPic: 123,
          orderStatus: 1,
          orderName: '但是法师',
          orderAddress: '福建省三明市',
          buyerName: '加油',
          storeName: '的发挥地方给',
          storeId: 34645675765,
          storeAddress: '河南省海口市',
          orderTime: '2017-10-20T09:15:44.000+0000'
        },
        {
          id: 27,
          orderId: 35436576,
          orderPic: 123,
          orderStatus: 2,
          orderName: '但是师',
          orderAddress: '福建省厦门市',
          buyerName: '多份',
          storeName: '的方给',
          storeId: 4565723465757,
          storeAddress: '河南省三亚市',
          orderTime: '2019-11-20T09:15:44.000+0000'
        },
        {
          id: 28,
          orderId: 345465765345,
          orderPic: 123,
          orderStatus: 2,
          orderName: '是师',
          orderAddress: '甘肃省福州市',
          buyerName: '符文',
          storeName: '的123给',
          storeId: 54352523543,
          storeAddress: '河南省三沙市',
          orderTime: '2019-05-20T09:15:44.000+0000'
        },
        {
          id: 29,
          orderId: 543676578,
          orderPic: 123,
          orderStatus: 3,
          orderName: '是他人师',
          orderAddress: '甘肃省兰州市',
          buyerName: '主管',
          storeName: '的是的给',
          storeId: 547353266546,
          storeAddress: '河南省五指山市',
          orderTime: ''
        },
        {
          id: 30,
          orderId: 54354645725,
          orderPic: 123,
          orderStatus: 3,
          orderName: '人师',
          orderAddress: '甘肃省金昌市',
          buyerName: '高峰',
          storeName: '的他人给',
          storeId: 6546346536436,
          storeAddress: '河南省琼海市',
          orderTime: ''
        }
      ]
    }
  }
})

// 订单详情
router.get('/orderDetail', async (ctx, next) => {
  const id = ctx.request.query.id
  // console.log(id)
  // ctx.body = orderDetail[id]
  ctx.body = {
    code: 200,
    message: "调用成功",
    result: orderDetail[id]
  }
})

module.exports = router